package PTA_03_09;

import java.util.Scanner;

public class s2 {
    public static void main(String[] args) {
        //求两个整数的最小公倍数和最大公约数
        Scanner sc = new Scanner(System.in);
        int num1 = sc.nextInt();
        int num2 = sc.nextInt();
        if(num2 > num1)
        {
            int temp = num1;
            num1 = num2;
            num2 = temp;
        }
        int a = gys(num1 ,num2);
        int b = gbs(num1 ,num2);
        System.out.println("最大公约数是:" + a);
        System.out.println("最小公倍数是:" + b);
    }
    public static int gys(int num1,int num2)
    {
        int temp;
        while(num1 != 0 && num2 != 0)
        {
            temp = num2 % num1;
            num2 = num1;
            num1 = temp;
        }
        return num2;
    }
    public static int gbs(int num1,int num2)
    {
        for (int i = num1; i < num1 * num2; i++)
        {
            if(i % num1 ==0 && i % num2 ==0)
            {
                return i;
            }
        }
        return num1 * num2;
    }
}
